{
 "cells": [
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "a3b177dc-39f1-4df4-b475-bafaa04745ac",
   "metadata": {},
   "source": [
    "<img src=\"images/strathsdr_banner.png\" align=\"left\">"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "e999ae01-ffb7-4fb1-bc6f-dceea2be9d1e",
   "metadata": {},
   "source": [
    "# RFSoC Radio Setup\n",
    "\n",
    "----\n",
    "\n",
    "<div class=\"alert alert-box alert-info\">\n",
    "Please use Jupyter Labs http://board_ip_address/lab for this notebook.\n",
    "</div>\n",
    "\n",
    "Select your development board from the list below and follow the hardware setup instructions before proceeding to the demonstration notebook.\n",
    "\n",
    "## Table of Contents\n",
    "* [1. ZCU111 Setup](#zcu111)\n",
    "* [2. RFSoC2x2 Setup](#rfsoc2x2)\n",
    "* [3. RFSoC4x2 Setup](#rfsoc4x2)\n",
    "* [4. ZCU208 and ZCU216 Setup](#zcu208_and_zcu216)\n",
    "    * [4.1. CLK104 Setup](#clk104_setup)\n",
    "    * [4.2. ADC Setup](#adc_setup)\n",
    "    * [4.3. DAC Setup](#dac_setup)\n",
    "    * [4.4. Loopback Setup](#loopback_setup)\n",
    "\n",
    "## Revision History\n",
    "* **v1.0** | 03/05/2023 | First Release\n"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "28eba278-ff94-4ade-afa5-355f72b26db1",
   "metadata": {},
   "source": [
    "----"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "d8c678bb-e371-4e79-a44b-c8244e13407e",
   "metadata": {
    "tags": []
   },
   "source": [
    "## 1. ZCU111 Setup <a class=\"anchor\" id=\"zcu111\"></a>\n",
    "Your ZCU111 development board should be setup in single channel mode. There are several SMA interfaces on your board that are labelled DAC or ADC. To setup your board for this demonstration, you can connect a loopback channel as shown in [Figure 1](#fig-1).\n",
    "\n",
    "The default loopback configuration in this demonstration is connected as follows:\n",
    "* ADC0 (Tile 224 Block 0) to DAC6 (Tile 229 Block 2)\n",
    "\n",
    "<a class=\"anchor\" id=\"fig-1\"></a>\n",
    "<figure>\n",
    "<img src='images/zcu111_setup.jpg' height='50%' width='50%'/>\n",
    "    <figcaption><b>Figure 1: zcu111 development board setup in loopback mode.</b></figcaption>\n",
    "</figure>\n",
    "\n",
    "The loopback connection will be useful for running the BPSK demonstrator. **Do Not** attach an antenna to any SMA interfaces labelled DAC."
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "ababbcfc-916a-4f14-8db7-723cf4d2fd00",
   "metadata": {
    "tags": []
   },
   "source": [
    "## 2. RFSoC2x2 Setup <a class=\"anchor\" id=\"rfsoc2x2\"></a>\n",
    "Your RFSoC2x2 development board should be setup in single channel mode. There are four SMA interfaces on your board that are labelled DAC1, DAC2, ADC1, and ADC2. To setup your board for this demonstration, you can connect a loopback channel as shown in [Figure 2](#fig-2).\n",
    "\n",
    "The default loopback configuration in this demonstration is connected as follows:\n",
    "* DAC1 to ADC1\n",
    "\n",
    "<a class=\"anchor\" id=\"fig-2\"></a>\n",
    "<figure>\n",
    "<img src='images/rfsoc2x2_setup.jpg' height='50%' width='50%'/>\n",
    "    <figcaption><b>Figure 2: RFSoC2x2 development board setup in loopback mode.</b></figcaption>\n",
    "</figure>\n",
    "\n",
    "The loopback connection will be useful for running the BPSK demonstrator. **Do Not** attach an antenna to any SMA interfaces labelled DAC1 or DAC2."
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "81de1f23-56a1-4c29-952f-846a4634b861",
   "metadata": {
    "tags": []
   },
   "source": [
    "## 3. RFSoC4x2 Setup <a class=\"anchor\" id=\"rfsoc4x2\"></a>\n",
    "Your RFSoC4x2 development board should be setup in single channel mode. There are six SMA interfaces on your board that are labelled. To setup your board for this demonstration, you can connect a loopback channel as shown in [Figure 3](#fig-3).\n",
    "\n",
    "The default loopback configuration in this demonstration is connected as follows:\n",
    "* DAC_A to ADC_A\n",
    "\n",
    "<a class=\"anchor\" id=\"fig-3\"></a>\n",
    "<figure>\n",
    "<img src='images/rfsoc4x2_setup.png' height='50%' width='50%'/>\n",
    "    <figcaption><b>Figure 3: RFSoC4x2 development board setup in loopback mode.</b></figcaption>\n",
    "</figure>\n",
    "\n",
    "The loopback connection will be useful for running the radio demonstrator. **Do Not** attach an antenna to any SMA interfaces labelled DAC_A or DAC_B."
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "2b902aa2-e0d6-4dff-b65a-ac8c78094ed1",
   "metadata": {
    "tags": []
   },
   "source": [
    "## 4. ZCU208 and ZCU216 Setup <a class=\"anchor\" id=\"zcu208_and_zcu216\"></a>\n",
    "The ZCU208 and ZCU216 development boards require the SMA and clock connections to be setup correctly. We will begin with connecting the clocks from the Clk104 card to the development board. Then connect the ADC and DAC to the HW_XM_655 card's RF baluns.\n",
    "\n",
    "Before you begin with the setup below, ensure that the Clk104 card and HW_XM_655 card is securely connected to the ZCU208 or ZCU216 development board.\n",
    "\n",
    "### 4.1. CLK104 Setup <a class=\"anchor\" id=\"clk104_setup\"></a>\n",
    "On the Clk104 board, make the following connections as shown in [Figure 4](#fig-4).\n",
    "\n",
    "<a class=\"anchor\" id=\"fig-4\"></a>\n",
    "<figure>\n",
    "<img src='images/clk104_setup.jpg' height='50%' width='50%'/>\n",
    "    <figcaption><b>Figure 4: Setup of the clk104 add-on board on the ZCU208 or ZCU216.</b></figcaption>\n",
    "</figure>\n",
    "\n",
    "Ensure that the clocks above are connected as follows:\n",
    "* DAC_229_CLK to DAC_RFCLK_B (P & N).\n",
    "* ADC_225_CLK to ADC_RFCLK_B (P & N).\n",
    "\n",
    "If you do not make the correct connection, the demonstration will not operate correctly.\n",
    "\n",
    "### 4.2. ADC Setup <a class=\"anchor\" id=\"adc_setup\"></a>\n",
    "The next step is to connect the ADC to the RF Balun on the HW_XM_655 card. See the image below in [Figure 5](#fig-5) on how to make this connection successfully. You will need the rectangle connector that contains a strip of wires with SMAs attached to make this connection. This connector is known as the Carlisle SMA 8 Cable Assemblies in the kit contents page supplied with your development board.\n",
    "\n",
    "<a class=\"anchor\" id=\"fig-5\"></a>\n",
    "<figure>\n",
    "<img src='images/zcu2xx_adc_setup.jpg' height='50%' width='50%'/>\n",
    "    <figcaption><b>Figure 5: Setting-up the ADC on the HW_XM_655 card.</b></figcaption>\n",
    "</figure>\n",
    "\n",
    "Ensure that the ADC connections are setup as follows:\n",
    "* JHC5 P0_255 to J18\n",
    "* JHC5 N01_255 to J16\n",
    "\n",
    "This step is a little difficult as there are many small wires. Please take your time setting up the ADC to prevent errors.\n",
    "\n",
    "### 4.3. DAC Setup <a class=\"anchor\" id=\"dac_setup\"></a>\n",
    "The DAC is connected to the RF Balun on the HW_XM_655 card using the connections shown in [Figure 6](#fig-6) below.\n",
    "\n",
    "<a class=\"anchor\" id=\"fig-6\"></a>\n",
    "<figure>\n",
    "<img src='images/zcu2xx_dac_setup.jpg' height='50%' width='50%'/>\n",
    "    <figcaption><b>Figure 6: Setting-up the DAC on the HW_XM_655 card.</b></figcaption>\n",
    "</figure>\n",
    "\n",
    "Ensure that the DAC connections are setup as follows:\n",
    "* JHC3 P0_230 to J39\n",
    "* JHC3 N0_230 to J37\n",
    "\n",
    "Take your time with this step to prevent errors during the demonstration.\n",
    "\n",
    "### 4.4. Loopback Setup <a class=\"anchor\" id=\"loopback_setup\"></a>\n",
    "We can now connect each RF Balun together using an SMA cable contained in your ZCU208 or ZCU216 box. The image below in [Figure 7](#fig-7) shows how to make this connection.\n",
    "\n",
    "<a class=\"anchor\" id=\"fig-7\"></a>\n",
    "<figure>\n",
    "<img src='images/zcu2xx_sma_conn.jpg' height='50%' width='50%'/>\n",
    "    <figcaption><b>Figure 7: Connecting the ADC to the DAC in loopback mode on the HW_XM_655 card.</b></figcaption>\n",
    "</figure>\n",
    " \n",
    "The connection shown in the image above is the following:\n",
    "* J17 (LFB_ADC_02) to J38 (LFB_DAC_01)\n",
    "\n",
    "Your ZCU208 or ZCU216 development board is now ready for the demonstration."
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "39c05f14-90e5-48d7-ad29-aa5fbe6a5466",
   "metadata": {},
   "source": [
    "## 5. Summary\n",
    "Your RFSoC development board will now be ready for the radio demonstration. Click the following link to navigate to the demonstration notebook.\n",
    "\n",
    "\n",
    "[Next Notebook](02_rfsoc_radio_demonstrator.ipynb) 🚀"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
